package com.bolt.auth.security.auth.server.component;

import com.bolt.common.security.Md5Util;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Component;

@Component
public class CustomMD5PasswordEncoder implements PasswordEncoder {
    @Override
    public String encode(CharSequence rawPassword) {
        return Md5Util.md5((String) rawPassword);
    }

    @Override
    public boolean matches(CharSequence rawPassword, String encodedPassword) {
        return encodedPassword.equals(Md5Util.md5((String)rawPassword));
    }

    public static void main(String[] args) {
        System.out.println(Md5Util.md5("owen"));
    }
}


 